home *** CD-ROM | disk | FTP | other *** search
- /*
- ** ConvertBlock.ced
- **
- ** $VER: ConvertBlock.ced 1.1 (20.10.93)
- **
- ** This script is designed to execute from a window within CED to
- ** convert the highlighted area (in a block). It works similar
- ** to the built-in functions Rot Marked and Change Case Marked. You specify
- ** an area, then call this function.
- **
- ** Note:
- ** 1. The 'CVT' command must be present in your command path in order for
- ** this program to run.
- ** 2. This program works with temporary files in T:, so you might want to
- ** modify it to store instead on a more appropriate device.
- **
- ** This script requires CygnusEd Professional v3.5 (or later) to run.
- **
- ** It is part of the CV package and very loosely based on SortBlock.ced which is
- ** Copyright © 1990-1993 ASDG, Incorporated All Rights Reserved
- **
- */
-
- ADDRESS "rexx_ced"
- OPTIONS RESULTS
-
- TempOriginalBlock = "T:TempOriginalBlock"
- TempConvertedBlock = "T:TempConvertedBlock"
- ConversionScript = "Empty"
- CVScriptsPath= ""
-
- IF OPEN(fp,"ENV:CVSCRIPTS",'R') THEN DO
- done= EOF(fp);
- DO UNTIL done
- c= READCH(fp)
- done = (c = ',') | (c = ';') | EOF(fp)
- IF ~done THEN CVScriptsPath= CVScriptsPath || c
- END
- dummy= CLOSE(fp)
- IF (CVScriptsPath = "") | (CVScriptsPath = ".") THEN DO
- STATUS CURRENTDIR
- CVScriptsPath= RESULT
- END
- IF (CVScriptsPath ~= "") THEN DO
- IF (RIGHT(CVScriptsPath,1) ~= '/') & (RIGHT(CVScriptsPath,1) ~= ':') THEN
- CVScriptsPath = CVScriptsPath || '/'
- END
- ELSE DO
- OKAY1 "Can't locate CV scripts. -- Sorry."
- EXIT 0
- END
- END
- ELSE DO
- OKAY1 "Can't find environment variable CVSCRIPTS"
- EXIT 0
- END
-
- CUT
- IF (RESULT ~= 0) THEN DO
- GETFILENAME CVScriptsPath '"Convert Block Using ..."'
- ConversionScript= RESULT
- IF(ConversionScript = "") | (ConversionScript = "RESULT") THEN DO
- PASTE
- EXIT 0
- END
- SAVE CLIP AS TempOriginalBlock
-
- From = '"' || TempOriginalBlock || '"'
- To = '-o "' || TempConvertedBlock || '"'
-
- ADDRESS COMMAND 'CVT -s -f "' || ConversionScript || '"' From To
-
- ADDRESS "rexx_ced" INCLUDE FILE TempConvertedBlock
- /*
- ** This STATUS command will ensure that CED finishes loading the
- ** sorted file before ARexx sends off the command to delete the file.
- */
- STATUS RESTNAME
-
- ADDRESS COMMAND "Delete > NIL:" TempOriginalBlock
- ADDRESS COMMAND "Delete > NIL:" TempConvertedBlock
- END
- ELSE DO
- CEDTOFRONT
- OKAY1 "Can't convert block. No area was marked."
- END
-
- EXIT 0
-